package com.dnzx.controller.system;

import javax.annotation.Resource;
import javax.validation.Valid;

import org.dnzx.framework.result.ResultUtils;
import org.dnzx.framework.result.domain.Result;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.dnzx.client.IRoleMenuClient;
import com.dnzx.model.system.RoleMenuBO;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

@RestController
@RequestMapping("/roleMenu")
@Api(value="/roleMenu",description="角色菜单配置",produces=MediaType.APPLICATION_JSON_VALUE)
public class RoleMenuController {
	
	@Resource
	private IRoleMenuClient roleMenuClient;
	
	/**
	 * 新增
	 * @param roleMenuBO
	 * @return
	 */
	@PostMapping(value = "/save")
    @ApiOperation(value = "/save",notes = "新增：roleId,menuIdList:格式[1,2,3,4]",httpMethod = "POST",produces = MediaType.APPLICATION_JSON_VALUE)
    public Result save(@ApiParam(value = "实体") @RequestBody @Valid RoleMenuBO roleMenuBO){
		try{
			this.roleMenuClient.save(roleMenuBO);
	        return ResultUtils.returnSuccess("SUCCESS");
        }catch (Exception e){
            return ResultUtils.returnError("ERROR >>> " + e.getMessage());
        }
    }
	
}
